package fr.imag.m2pgi.m2m.geoloc.mqtt.subscriber;

/*
import org.eclipse.paho.client.mqttv3.MqttCallback;
import org.eclipse.paho.client.mqttv3.MqttClient;
import org.eclipse.paho.client.mqttv3.MqttDeliveryToken;
import org.eclipse.paho.client.mqttv3.MqttException;
import org.eclipse.paho.client.mqttv3.MqttMessage;
import org.eclipse.paho.client.mqttv3.MqttTopic;
*/

public class Subscriber implements SubscribeService {
  /* 
  MqttClient client;

  public Subscriber(String server, String port) throws MqttException {
    client = new MqttClient("tcp://"+server+":"+port, "mp2pgi-geoloc");
    client.connect();
    client.setCallback(this);
    client.subscribe("geoloc/lidar", 0);
    
  }
  
  public void connectionLost(Throwable arg0) {
    
  }

  public void deliveryComplete(MqttDeliveryToken arg0) {
    
  }

  public void messageArrived(MqttTopic topic, MqttMessage msg) throws Exception {
    String str = new String(msg.getPayload());
    String[] val = str.split(":");
    System.out.println("[NEW] z= "+val[0]+" angle= "+val[1]);
  }

  public void disconnect() throws MqttException {
    client.disconnect();
  }*/


}
